package com.mzj.saas.mservice.area.repository;

import com.mzj.saas.mservice.area.entity.Area;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

public interface AreaRepository extends PagingAndSortingRepository<Area, Long>, JpaSpecificationExecutor<Area> {

    List<Area> findByLevel(Integer level);

    List<Area> findByLevelAndNameLike(Integer level, String name);

    Area findByLevelAndName(Integer level, String name);

    Area findByIdAndLevel(Long id, Integer level);

    List<Area> findByParentId(Long parentId);

    List<Area> findByParentIdIn(List<Long> parentIds);

    Area findByName(String name);

    List<Area> findByIdIn(List<Long> ids);

    List<Area> findByParentIdAndLevelAndNameLike(Long parentId, Integer level, String name);
}
